#include "taskexplorer.h"

#include <pubsub.h>

TaskExplorer::TaskExplorer() {
    this->log = LogUtil::getLogger("plugin-taskexplorer");
}

QString TaskExplorer::pluginName() {
    return "taskexplorer";
}
QString TaskExplorer::pluginVersion() {
    return AppConfig::getInstance()->appVersion();
}
QString TaskExplorer::author() {
    return "janna";
}

QMap<QString, QVariant> TaskExplorer::handler(const JannaTopic& topic, const QMap<QString, QVariant>& param) {
    if ("janna" == topic.source && "echo-taskexplorer" == topic.topic) {
        SPDLOG_LOGGER_DEBUG(this->log, fmt::format("plugin-taskexplorer ===> message is : {}",
                                                   param.value("msg").toString().toStdString()));
        return QMap<QString, QVariant>();
    }
    if ("janna.taskbuttons" == topic.source && "taskbuttons-count" == topic.topic) {
        SPDLOG_LOGGER_DEBUG(this->log, fmt::format("plugin-taskexplorer ===> message is : {}",
                                                   param.value("taskbuttons-count").toInt()));
        return QMap<QString, QVariant>();
    }
    return QMap<QString, QVariant>();
}
